using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class StatusCodeInfoMap : EntityTypeConfiguration<StatusCodeInfo>
	{
		public StatusCodeInfoMap()
		{
			// Primary Key
			this.HasKey(t => new { t.CodeType, t.CodeNo });

			// Properties
			this.Property(t => t.CodeType)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.CodeNo)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.CodeDesc)
				.HasMaxLength(50);
				
			this.Property(t => t.CreatBy)
				.HasMaxLength(20);
				
			this.Property(t => t.UpdateBy)
				.HasMaxLength(20);
				
			// Table & Column Mappings
			this.ToTable("StatusCodeInfo");
			this.Property(t => t.CodeType).HasColumnName("CodeType");
			this.Property(t => t.CodeNo).HasColumnName("CodeNo");
			this.Property(t => t.CodeDesc).HasColumnName("CodeDesc");
			this.Property(t => t.OrderBy).HasColumnName("OrderBy");
			this.Property(t => t.Enabled).HasColumnName("Enabled");
			this.Property(t => t.CreatBy).HasColumnName("CreatBy");
			this.Property(t => t.CreatDate).HasColumnName("CreatDate");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
		}
	}
}

